package com.cyy.admin.repository;

import com.cyy.admin.entity.CyyUserEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

/**
 * 系统用户表
 * 
 * @author chenyuyi
 * @date 2021-12-01 16:43:08
 *
 * 接口用法大全。
 * https://mapperhelper.github.io/all/
 */
@Repository
public interface CyyUserRepository extends JpaRepository<CyyUserEntity,String>, JpaSpecificationExecutor<CyyUserEntity> {

    @Modifying
    @Transactional
    @Query("update CyyUserEntity set userName=?1")
    int updateById(String name);

    @Query("select c from CyyUserEntity c where loginName=?1")
    CyyUserEntity findByUserName(String loginName);

}
